
package exceptions;
import be.kuleuven.cs.som.annotate.Basic;

/**
 * A class for signaling overflows in arithmetic operations.
 * 
 * @author  Maarten
 * @version 2.2
 */
public class OverflowException extends RuntimeException {

	/**
	 * Initialize this new overflow exception with given operands.
	 * 
	 * @param   left
	 *          The left operand in this new overflow exception.
	 * @param   right
	 *          The right operand in this new overflow exception.
	 * @post    The left operand of this new overflow exception is equal
	 *          to the given left operand.
	 *        	|new.getLeftOperand() == left
	 * @post    The right operand of this new overflow exception is equal
	 *          to the given right operand.
	 *        	|new.getRightOperand() == right
	 */
	public OverflowException(int left, int right) {
		this.left = left;
		this.right = right;
	}
	public OverflowException() {
		this.left = 0;
		this.right = 0;
	}
	

	/**
	 * Return the left operand involved in this overflow exception.
	 */
	@Basic
	public int getLeftOperand() {
		return this.left;
	}

	/**
	 * Return the right operand involved in this overflow exception.
	 */
	
	public int getRightOperand() {
		return this.right;
	}

	/**
	 * Variables registering the left operand, respectively the
	 * right operand for this overflow exception.
	 */
	private final int left;
	private final int right;
	private static final long serialVersionUID = 1L;


}